package com.zhongwang.mms.module.material.controller;

import com.zhongwang.mms.base.BaseController;
import com.zhongwang.mms.common.JsonResult;
import com.zhongwang.mms.gen.entity.MChangeOrder;
import com.zhongwang.mms.module.material.model.ChangeOrderRetMatModel;
import com.zhongwang.mms.module.material.model.MChangeOrderModel;
import com.zhongwang.mms.module.material.service.MatRetManageService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Arrays;
import java.util.List;

/**
 * @author 徐一贺
 * @className MatRetManageController
 * @description 还料管理控制层
 * @date 2020/11/28 9:24
 * @versron ver 1.0
 */
@Controller
@RequestMapping("/material/matInvManage/matRetManage")
public class MatRetManageController extends BaseController {
    @Autowired
    private MatRetManageService service;

    /**  page 页面跳转到还料管理页面
     * @return java.lang.String
     * @author 徐一贺
     * @date 2020/11/28 9:33
     */
    @GetMapping
    @RequiresPermissions("matinv:retMat:view")
    public String page(){
        return "material/matWarManage/matRetManage/page";
    }

    /**  findMChangeOrderByQuery 还料列表
     * @param changeOrderModel 检索参数
     * @return java.util.List<com.zhongwang.mms.gen.entity.MChangeOrder> 还料列表数据
     * @author 徐一贺
     * @date 2020/11/28 10:02
     */
    @ResponseBody
    @PostMapping("/list")
    @RequiresPermissions("matinv:retMat:view")
    public JsonResult list(MChangeOrderModel changeOrderModel) {
//        startPage();
        changeOrderModel.setCeoStatusStr("3,4,5,6");
        List<ChangeOrderRetMatModel> list = service.findMChangeOrderByQuery(changeOrderModel);
        return jsonResult(list);
    }
    /**  confirm 确认换料
     * @param param 参数
     * @return com.zhongwang.mms.common.JsonResult
     * @exception
     * @author 徐一贺
     * @date 2020/11/28 12:41
     */
    @ResponseBody
    @PostMapping("/confirm")
    @RequiresPermissions("matinv:retMat:view")
    public JsonResult confirm(ChangeOrderRetMatModel param) {
        return service.confirm(param);
    }
    /**  ignoreTips 忽略还料提醒
     * @param param 参数
     * @return com.zhongwang.mms.common.JsonResult
     * @exception
     * @author 徐一贺
     * @date 2020/11/28 12:41
     */
    @ResponseBody
    @PostMapping("/ignoreTips")
    @RequiresPermissions("matinv:retMat:view")
    public JsonResult ignoreTips(ChangeOrderRetMatModel param) {
        return service.ignoreTips(param);
    }
}
